package com.itlong.cloud.iot.alibaba.util;

import com.aliyuncs.AcsResponse;
import com.aliyuncs.RpcAcsRequest;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;

/**
 * 阿里IoT网络请求执行器基类
 * @createDate 2018-03-14
 */
@Service
@RefreshScope
public class AliRequestClient {
    private static final Logger LOG = LoggerFactory.getLogger(AliRequestClient.class);
    @Autowired
    AliIotInitClient aliIotInitClient;

    /**
     * <desc>
     *      获取请求响应对象
     * </desc>
     *
     * @param request
     * @return
     * @author Jiaqi.X
     * @createDate 2018/03/17
     */
    public  AcsResponse executeTest(RpcAcsRequest request) {
        AcsResponse response = null;
        try {
            response = aliIotInitClient.getClient().getAcsResponse(request);
        } catch (Exception e) {
            LOG.info("IotBaseService.executeTest执行失败：e:" + e.getMessage());
        }
        return response;
    }




}
